<%= render :partial => 'gwt/base', :locals => {:resource => nil, :popup => false, :metric => (@metric ? @metric.key : nil)} -%>
<%= render :partial => 'gwt/resource_viewers' -%>

<script type="text/javascript">
  /* display resource */
  function d(resourceId, is_file) {
    var action = is_file ? 'index' : 'view';
    var url = '<%= ApplicationController.root_context -%>/resource/' + action + '/' + resourceId + '?metric=<%= @metric.id if @metric -%>' +
        '&rule=<%= @rule ? @rule.id : @severity -%>&period=<%= @period -%>&project=<%= @resource.id -%>';
    openAccordionItem(url);
    return false;
  }

  // refresh page after issues bulk change
  function onBulkIssues(issues_query_params){
    if (issues_query_params['components'] != null) {
      d(issues_query_params['components']);
      closeModalWindow();
    } else {
      window.location.reload();
    }
  }

  function loadGWT(gwtId, resourceId, resourceKey, resourceName, resourceScope, resourceQualifier, resourceLanguage) {
    config["resource"] = [
      {"id":resourceId, "key":resourceKey, "name":resourceName, "scope":resourceScope, "qualifier":resourceQualifier,
        "lang":resourceLanguage}
    ];
    config["resource_key"] = resourceId;
    modules[gwtId]();
  }
</script>
